<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 
class Pdf_report extends CI_Controller {
     
    public function index($rev_id)
    {
        // Load library FPDF 
        $this->load->library('fpdf');
         
        // Load Database
        $this->load->database('hms');
         
        /* buat konstanta dengan nama FPDF_FONTPATH, kemudian kita isi value-nya
           dengan alamat penyimpanan FONTS yang sudah kita definisikan sebelumnya.
           perhatikan baris $config['fonts_path']= 'system/fonts/'; 
           didalam file application/config/config.php
        */           
        define('FPDF_FONTPATH',$this->config->item('fonts_path'));
         
        // Load model "karyawan_model"
        $this->load->model('reservation_model');
         
        /* Kita akses function get_all didalam karyawan_model
           function get_all merupakan fungsi yang dibuat untuk mengambil
           seluruh data karyawan didalam database.
        */
		$data['g'] = $this->reservation_model->get_guest ($rev_id)->row_array();
		$data['ro'] = $this->reservation_model->get_room ($rev_id)->result_array();
		$data['m'] = $this->reservation_model->get_material ($rev_id)->result_array();
		$data['tr'] = $this->reservation_model->total_reservation ($rev_id)->row_array();
		$data['tm'] = $this->reservation_model->total_material ($rev_id)->row_array();
		$data['s'] = $this->reservation_model->get_service($rev_id)->result_array();
		$data['t'] = $this->reservation_model->total_service($rev_id)->row_array();
		$data['ts'] = $this->reservation_model->transaction($rev_id)->result_array();
		$data['tt'] = $this->reservation_model->tottransaction($rev_id)->row_array();
		  
         
        // Load view "pdf_report" untuk menampilkan hasilnya        
        $this->load->view('pdf/pdf_receipt', $data);
    }
}